import type { EffectType } from '@/utils/effect'
import { RECIPE_CONDIMENT_MAP, GOLD_RUNE, SILVER_RUNE, BRONZE_RUNE } from './mappings'

/** 调料 */
export type RecipeCondiment = keyof typeof RECIPE_CONDIMENT_MAP

/**
 * 菜谱
 * @boil 煮
 * @knife 切
 * @bake 烤
 * @fry 炸
 * @steam 蒸
 * @stirfry 炒
 * @condiment 调料
 * @materials 食材
 */
export interface IRecipe {
  recipeId: number
  galleryId: string
  name: string
  rarity: number
  price: number
  exPrice: number
  time: number
  limit: number
  boil: number
  knife: number
  bake: number
  fry: number
  steam: number
  stirfry: number
  condiment: RecipeCondiment
  gift: Gift | '-'
  materials: {
    material: number
    quantity: number
  }[]
}

/**
 * 厨师
 * @rarity 星级
 * @boil 煮
 * @knife 切
 * @bake 烤
 * @fry 炸
 * @steam 蒸
 * @stirfry 炒
 * @fish 水产
 * @creation 作坊
 * @meat 肉禽
 * @veg 蔬菜
 * @bitter 苦
 * @tasty 鲜
 * @sweet 甜
 * @spicy 辣
 * @salty 咸
 * @sour 酸
 */
export interface IChef {
  chefId: number
  galleryId: string
  name: string
  rarity: number
  boil: number
  knife: number
  bake: number
  fry: number
  steam: number
  stirfry: number
  fish: number
  creation: number
  meat: number
  veg: number
  bitter: number
  tasty: number
  sweet: number
  spicy: number
  salty: number
  sour: number
  skill: number
}

/** 符文 */
export type Gift =
  | (typeof GOLD_RUNE)[number]
  | (typeof SILVER_RUNE)[number]
  | (typeof BRONZE_RUNE)[number]

/** 探索 */
export interface ICollectItem {
  name: string
  materials: {
    name: string
    skill: number
  }[]
  time: number[]
}

/** 食材 */
export interface IMaterialItem {
  materialId: number
  name: string
  origin: string
}

/** 厨师装备 */
export interface IEquipItem {
  equipId: number
  skill: number[]
  name: string
  origin: string
  rarity: number
}

export const COLLECTING_SKILL_MAP = {
  Vegetable: 'veg',
  Fish: 'fish',
  Creation: 'creation',
  Meat: 'meat',
} as const

/** 采集菜园技能 */
export type CollectingSkillType = keyof typeof COLLECTING_SKILL_MAP

/** 厨师技能 */
export interface ISkillItem {
  skillId: number
  desc: string
  effect: {
    cal: string
    condition: string
    type: EffectType
    value: number
  }[]
}

/** 游戏源数据 */
export interface IGame {
  chefs: IChef[]
  recipes: IRecipe[]
  maps: ICollectItem[]
  equips: IEquipItem[]
  skills: ISkillItem[]
  materials: IMaterialItem[]
}

/** 玩家菜谱 */
export interface IPlayerRecipe {
  id: number
  got: string
  rank: string
  ex: string
}

/** 玩家厨师 */
export interface IPlayerchef {
  id: number
  got: string
  equip: number
  ult: string
}

/** 玩家数据 */
export interface IPlayer {
  recipes: IPlayerRecipe[]
  chefs: IPlayerchef[]
  decorationEffect: number
}
